package com.cdc.tools;

import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.cdc.bean.person.Address;
import com.cdc.bean.person.Education;
import com.cdc.bean.person.Person;

public class PersonTools {
	
	public static Map<Integer,Person> initPersons(){
		Map<Integer,Person> persons=new HashMap<>();
		
		persons.put(0, initDefaultPerson());
		
		Map<String,String> contacts1=new HashMap<>();
		contacts1.put("qq", "10000");
		contacts1.put("wechat", "10001");
		contacts1.put("email", "10000@qq.com");
		contacts1.put("phone", "13010101010");
		Address address1=new Address("浙江省绍兴嵊州市(原嵊县)谷来镇","浙江省杭州市","浙江省杭州市");
		List<String> hobbies1=new ArrayList<>();
		hobbies1.add("演讲");
		hobbies1.add("表演");
		
		List<String> annexs1=new ArrayList<>();
		annexs1.add("https://cdcdec.github.io/images/1024_1.jpg");
		annexs1.add("https://cdcdec.github.io/images/1024_2.jpg");
		annexs1.add("https://cdcdec.github.io/images/1024_3.jpg");
		Person person1 = new Person(1l,"马云",53,180.19,180.50,true,contacts1,address1,"商人",Education.University,setDate(1964,10,15),hobbies1,new Date(),annexs1);
		persons.put(1, person1);
		
		Map<String,String> contacts2=new HashMap<>();
		contacts2.put("qq", "20000");
		contacts2.put("wechat", "20001");
		contacts2.put("email", "20000@qq.com");
		contacts2.put("phone", "13020202020");
		Address address2=new Address("广东潮阳县(现汕头市潮南区)","海南岛东方市八所港","广东深圳");
		List<String> hobbies2=new ArrayList<>();
		hobbies1.add("演讲");
		hobbies1.add("聊天");
		List<String> annexs2=new ArrayList<>();
		annexs2.add("https://cdcdec.github.io/images/1024_4.jpg");
		annexs2.add("https://cdcdec.github.io/images/1024_5.jpg");
		annexs2.add("https://cdcdec.github.io/images/1024_6.jpg");
		Person person2 = new Person(2l,"马化腾",46,180.19,180.50,true,contacts2,address2,"商人",Education.University,setDate(1971,10,29),hobbies2,new Date(),annexs2);
		persons.put(2, person2);
		
		Map<String,String> contacts3=new HashMap<>();
		contacts3.put("qq", "30000");
		contacts3.put("wechat", "30001");
		contacts3.put("email", "30000@qq.com");
		contacts3.put("phone", "13030303030");
		Address address3=new Address("湖南湘潭县","江苏省宿迁市","北京朝阳");
		List<String> hobbies3=new ArrayList<>();
		hobbies3.add("演讲");
		hobbies3.add("旅游");
		List<String> annexs3=new ArrayList<>();
		annexs3.add("https://cdcdec.github.io/images/sketch_eyes.jpg");
		annexs3.add("https://cdcdec.github.io/images/sketch_greetwal_high.jpg");
		annexs3.add("https://cdcdec.github.io/images/sketch_tree2_normal.jpg");
		annexs3.add("https://cdcdec.github.io/images/sketch_tree_immediate.jpg");
		Person person3 = new Person(3l,"刘强东",44,180.19,180.50,true,contacts3,address3,"商人",Education.University,setDate(1974,2,14),hobbies3,new Date(),annexs3);
		persons.put(3, person3);
		
		
		Map<String,String> contacts4=new HashMap<>();
		contacts4.put("qq", "40000");
		contacts4.put("wechat", "40001");
		contacts4.put("email", "40000@qq.com");
		contacts4.put("phone", "13040404040");
		Address address4=new Address("江苏省南京市","江苏省南京市","广东珠海");
		List<String> hobbies4=new ArrayList<>();
		hobbies4.add("演讲");
		hobbies4.add("旅游");
		List<String> annexs4=new ArrayList<>();
		annexs4.add("https://cdcdec.github.io/images/i750_1.jpg");
		annexs4.add("https://cdcdec.github.io/images/i750_2.jpg");
		annexs4.add("https://cdcdec.github.io/images/i750_3.jpg");
		Person person4 = new Person(4l,"董明珠",63,160.19,53,true,contacts4,address4,"商人",Education.University,setDate(1954,8,1),hobbies4,new Date(),annexs4);
		persons.put(4, person4);
		
		return persons;
	}
	
	public static Person initDefaultPerson() {
		Map<String,String> contacts=new HashMap<>();
		contacts.put("qq", "00000");
		contacts.put("wechat", "00001");
		contacts.put("email", "00000@qq.com");
		contacts.put("phone", "13000000000");
		Address address=new Address("幽州涿郡","河北涿州","四川阆中");
		List<String> hobbies=new ArrayList<>();
		hobbies.add("武术");
		hobbies.add("军事");
		hobbies.add("美食");
		hobbies.add("旅游");
		
		List<String> annexs=new ArrayList<>();
		annexs.add("https://cdcdec.github.io/images/thumbnail_0.jpg");
		annexs.add("https://cdcdec.github.io/images/thumbnail_1.jpg");
		annexs.add("https://cdcdec.github.io/images/thumbnail_2.jpg");
		Person person = new Person(0l,"张飞",1850,180.19,180.50,true,contacts,address,"军人",Education.HighSchool,setDate(167,7,5),hobbies,new Date(),annexs);
		return person;
	}
	
	private static Date setDate(int year, int month, int date) {
		GregorianCalendar c=new GregorianCalendar();
		c.set(year, month, date);
		return c.getTime();
	}
	
	public static List<String> add(String element){
		List<String> lists=new ArrayList<>();
		lists.add(element);
		return lists;
	}

}
